package com.admin.socketmultiplayer.adapter

import android.content.Context
import android.widget.ImageView
import com.admin.kotlintest.base.AdapterHolder
import com.admin.kotlintest.base.CurrencyAdapter
import com.admin.socketmultiplayer.R
import com.admin.socketmultiplayer.bean.Room
import kotlinx.android.synthetic.main.layout_room_list_item.view.*

/**
 * Created by 吴昶 on 2018/4/25.
 */
class RoomListAdapter(context: Context,layoutid:Int,data:MutableList<Room>?,var listener:RoomItemClickListener?):CurrencyAdapter<Room>(context,layoutid,data){

    override fun convert(holder: AdapterHolder, item: Room, position: Int) {
        holder.setTextViewText(R.id.tv_room_name,item.roomName)
        var image=holder.getImageView(R.id.iv_room_chiosed)
        var relat=holder.getRelativeLayout(R.id.relat_item)
        relat!!.setOnClickListener {
            listener!!.OnItemClickListener(item,image!!,position)
        }
    }

    interface RoomItemClickListener{
        fun OnItemClickListener(room:Room,image:ImageView,position: Int)
    }
}